<template>
  <el-table :data="logData" :border="true" style="width: 100%">
    <el-table-column prop="username" label="登入账户" />
    <el-table-column prop="lastLogin.ip" label="上次登入ip" />
    <el-table-column prop="lastLogin.loginTime" label="上次登入时间" sortable />
    <el-table-column prop="nowLogin.ip" label="本次登入ip" />
    <el-table-column prop="nowLogin.loginTime" label="本次登入时间" sortable />
  </el-table>
</template>

<script setup>
import * as api from "@/api/users.js";
import { ref, onBeforeMount } from "vue";
let logData = ref([]);

onBeforeMount(async () => {
  try {
    let res = await api.getLoginLogApi();
    logData.value = res.data.data;
  } catch (e) {
    console.log(e);
  }
});

//   {
//     username: "cxk",
//     lastLogin: {
//       loginTime: "2019/05/13 20:36:26",
//       ip: "175.27.248.9",
//     },
//     nowLogin: {
//       ip: "",
//       loginTime: "2019/05/13 20:36:43",
//     },
//   },
//   {
//     username: "cxk",
//     lastLogin: {
//       loginTime: "2019/05/13 20:36:26",
//       ip: "175.27.248.9",
//     },
//     nowLogin: {
//       ip: "",
//       loginTime: "2019/05/13 20:36:43",
//     },
//   },
//   {
//     username: "cxk",
//     lastLogin: {
//       loginTime: "2019/05/13 20:36:26",
//       ip: "175.27.248.9",
//     },
//     nowLogin: {
//       ip: "",
//       loginTime: "2019/05/13 20:36:43",
//     },
//   },
//   {
//     username: "cxk",
//     lastLogin: {
//       loginTime: "2019/05/13 20:36:26",
//       ip: "175.27.248.9",
//     },
//     nowLogin: {
//       ip: "",
//       loginTime: "2019/05/13 20:36:43",
//     },
//   },
// ];
</script>
<script>
export default {
  meta: {
    title: "glsy",
    name: "管理首页",
    routeName: "welcome",
    icon: "icon-shouye1",
  },
};
</script>
<style scoped>
.el-table--fit {
  margin-top: 30px;
}
</style>
